package role;

// 医生
public class Doctor extends Role {
    public Doctor() {
    }

    public Doctor(String name, int level, int gold) {
        super(name, level, gold);
        this.hp = this.level * 12;// hp
        this.atk = this.level * 2;// atk
        this.def = this.level * 2;// def
    }

    // 治疗
    public void cure() {
        this.hp += this.level * 2;
        if (this.hp > this.level * 12) {
            this.hp = this.level * 12;
        }
        System.out.println("给自己治疗成功,本次补充：" + this.level * 2 + "血，当前血量：" + this.hp);
    }

    public void cure(Soldier soldier) {
        int value = this.level * 2;// 补
        // 能治疗
        if (soldier.gold >= value) {
            soldier.gold -= value;
            soldier.hp += value;
            if (soldier.hp > soldier.level * 15) {
                soldier.hp = soldier.level * 15;
            }
        }
        System.out.println("治疗" + soldier.name + "成功,本次补充：" + this.level * 2 + "血，对方当前血量：" + soldier.hp + "对方金币：" + soldier.gold);


    }
}
